PROGRAM test
  
!!$ test is a sample program used to test modules.
!!$
!!$ STH: Samuel Harrold

  USE ModArray
  USE ModCoolTot
  
  IMPLICIT NONE
#INCLUDE "mpif.h"



!!$ BEGIN TESTING ModCoolTot
  REAL :: &
       ngas    = 1.E+10, &
       Tempgas = 500., &
       Jw      = 2, &
       Ntostar = 1.E20, &
       CoolCII, CoolOI, &
       CoolTot
  
  CALL CalcCoolTot(ngas = ngas, Tempgas = Tempgas, JwCII = Jw, JwOI02 = Jw, JwOI01 = Jw, JwOI12 = Jw, Ntostar = Ntostar, CoolTot = CoolTot)

  PRINT *, "test.F90 L26"
  PRINT *, "CoolTot = ", CoolTot
!!$ END TESTING ModCoolTot



!!$modarray !!$ BEGIN TESTING ModArray
!!$modarray   INTEGER, PARAMETER :: ni = 3, nj = 3, nk = 3
!!$modarray   REAL, DIMENSION(ni, nj, nk) :: Array3D
!!$modarray   INTEGER :: i, imin, imax, j, jmin, jmax, k, kmin, kmax
!!$modarray 
!!$modarray !!$ Print test array
!!$modarray   imin = 1
!!$modarray   jmin = imin
!!$modarray   kmin = imin
!!$modarray 
!!$modarray   imax = (ni - imin) + 1
!!$modarray   jmax = (nj - jmin) + 1
!!$modarray   kmax = (nk - kmin) + 1
!!$modarray 
!!$modarray   Array3D = RESHAPE( SOURCE = (/(((i + j*imax + k*jmax*kmax, i = imin, imax), j = jmin, jmax), k = kmin, kmax)/), SHAPE = (/ni, nj, nk/), PAD = (/0/), ORDER = (/1, 2, 3/))
!!$modarray 
!!$modarray   DO k = kmin, kmax, 1
!!$modarray      PRINT *
!!$modarray      DO i = imin, imax, 1
!!$modarray         PRINT *, (Array3D(i,j,k), j = jmin, jmax)
!!$modarray      END DO ! i = imin, imax, 1
!!$modarray   END DO ! k = kmin, kmax, 1
!!$modarray   PRINT *, SIZE(Array3D, 1)
!!$modarray 
!!$modarray !!$ Test module function
!!$modarray   CALL Write3DArrayAs2DArray(Array3DIn = Array3D, NumEltsD1In = SIZE(Array3D, 1), NumEltsD2In = SIZE(Array3D, 2), NumEltsD3In = SIZE(Array3D, 3), FileNameOut = 'test.out')
!!$modarray !!$ END TESTING ModArray


  
END PROGRAM test
